package com.googlecode.lightest.studio

class Test {
    String name
    String className
    String description
    boolean inPlay

    static belongsTo = TestSuite
    static hasMany = [
        testSuites: TestSuite,
        testResults: TestResult,
        annotations: Annotation
    ]
    
    static constraints = {
        name (blank: false)
        className (blank: false)
        description (nullable: true)
    }

    String toString() {
        return "${name} [${className}]"
    }

    @Override
    boolean equals(Object obj) {
        return (
            obj instanceof Test &&
            obj.name == name &&
            obj.className == className &&
            obj.description == description &&
            obj.inPlay == inPlay
        )
    }

    @Override
    int hashCode() {
        return name.hashCode() + className.hashCode()
    }
}
